using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using OgilvyOne.Model;
using OgilvyOne.BLL;

namespace OgilvyOne.ProcessFlow
{
    public class RoleController
    {
        // Fields
      //  private const string URL_CHECKLOGIN = "func_checklogin.aspx";
        private const string URL_DEFAULT = "/systemmanage/role/role_list.aspx";
       // private const string URL_MEMBERCREATE = "func_list.aspx";
       // private const string URL_MEMBERUPDATE = "func_modify.aspx";

        // Methods
        public bool CreateRole(RoleInfo newRoleInfo)
        {
            try
            {
                new Role().Insert(newRoleInfo);
                HttpContext.Current.Response.Redirect(URL_DEFAULT, true);
            }
            catch
            {
                return false;
            }
            return true;
        }

        public void DeleteRole(int func_uid)
        {
            new Role().Delete(func_uid);
            HttpContext.Current.Response.Redirect(URL_DEFAULT, true);
        }

        public void UpdateRole(RoleInfo updatedRoleInfo)
        {
            new Role().Update(updatedRoleInfo);
            HttpContext.Current.Response.Redirect(URL_DEFAULT, true);
        }

    }
}
